package com.lwy.setter.setters;


import com.lwy.setter.annos.CarrierCode;
import com.lwy.setter.BaseNameSetter;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <br/>
 *
 * @author lwy
 * @date 2024/10/11
 */
//@ConditionalOnExpression("'${starchain.base.base-data.functions}'.contains('carrier')" +
//        " || '${starchain.base.base-data.functions}'.contains('all')")
@Component
public class CarrierNameSetter extends BaseNameSetter<CarrierCode> {



    @Override
    protected Class<CarrierCode> getAnnotationClz() {
        return CarrierCode.class;
    }

    @Override
    public boolean isFillNameByCode() {
        return true;
    }

    @Override
    protected Map<String, String> getCodeNameMap(List<String> codes) {
        if (CollectionUtils.isEmpty(codes)) {
            return Collections.emptyMap();
        }
        HashMap<String, String> map = new HashMap<>(codes.size());
        for (String code : codes) {
            map.put(code, "名称来了");
        }
        return map;
    }
}
